{% extends "base.html" %}
{%- import "header/package_navigation.html" as navigation -%}

{%- block title -%}
    {% call macros::doc_title(name=metadata.name, version=metadata.version) %}
{%- endblock title -%}

{%- block meta -%}
<link rel="canonical" href="{{ canonical_url|safe }}" />
{%- endblock -%}

{%- block body_classes -%}
    centered
{%- endblock body_classes -%}

{%- block topbar -%}
  {%- include "rustdoc/topbar.html" -%}
{%- endblock topbar -%}

{%- block header -%}
    {% call navigation::package_navigation(metadata=metadata, active_tab="builds") %}
{%- endblock header -%}

{%- block body -%}
    <div class="container">
        <div class="recent-releases-container">
            {%- if !builds.is_empty() -%}
                <div class="release">
                    <strong>Builds</strong>
                </div>

                <ul>
                    <li>
                    {%- for build in builds -%}
                        <li>
                            {%- if build.build_status != "in_progress" -%}
                                <a href="{{ params.build_details_url(*build.id, None) }}" class="release"> {#- -#}
                                    <div class="pure-g"> {#- -#}
                                        <div class="pure-u-1 pure-u-sm-1-24 build">
                                            {%- if build.build_status == "success" -%}
                                                {{ crate::icons::IconCheck.render_solid(false, false, "") }}
                                            {%- elif build.build_status == "failure" -%}
                                                {{ crate::icons::IconTriangleExclamation.render_solid(false, false, "") }}
                                            {%- else -%}
                                                {{ crate::icons::IconX.render_solid(false, false, "") }}
                                            {%- endif -%}
                                        </div> {#- -#}
                                        <div class="pure-u-1 pure-u-sm-10-24">
                                            {%- if let Some(rustc_version) = build.rustc_version -%}
                                                {{ rustc_version }}
                                            {%- else -%}
                                                &mdash;
                                            {%- endif -%}
                                        </div> {#- -#}
                                        <div class="pure-u-1 pure-u-sm-10-24">
                                            {%- if let Some(docsrs_version) = build.docsrs_version -%}
                                                {{ docsrs_version }}
                                            {%- else -%}
                                                &mdash;
                                            {%- endif -%}
                                        </div> {#- -#}
                                        <div class="pure-u-1 pure-u-sm-3-24 date">
                                            {%- if let Some(build_time) = build.build_time -%}
                                                {{ build_time|timeformat }}
                                            {%- else -%}
                                                &mdash;
                                            {%- endif -%}
                                        </div> {#- -#}
                                    </div> {#- -#}
                                </a>
                            {%- else -%}
                                <div class="build-in-progress">
                                    <div class="pure-g"> {#- -#}
                                        <div class="pure-u-1 pure-u-sm-1-24 build">
                                            {{- crate::icons::IconGear.render_solid(false, true, "") -}}
                                        </div> {#- -#}
                                        <div class="pure-u-1 pure-u-sm-23-24 build"> {#- -#}
                                            In the <a href="/releases/queue" class="normal">build queue</a> {#- -#}
                                        </div>
                                    </div>
                                </div>
                            {%- endif -%}
                        </li>
                    {%- endfor -%}
                </ul>
            {%- else -%}
                <div class="warning">
                    docs.rs has not built {{ metadata.name }}-{{ metadata.version }}
                    <br>
                    It may still be <a href="/releases/queue">queued</a> or in-progress.
                    <br>
                    If you believe this is docs.rs' fault, <a href="https://github.com/rust-lang/docs.rs/issues/new/choose">open an issue</a>.
                </div>
            {%- endif -%}

            <div class="about">
                <h4>{{ metadata.name }}'s sandbox limits</h4>
                <p>
                    All the builds on docs.rs are executed inside a sandbox with limited
                    resources. The limits for this crate are the following:
                </p>

                {% call macros::crate_limits(limits=limits) %}

                <p>
                    If a build fails because it hit one of those limits please
                    <a href="https://github.com/rust-lang/docs.rs/issues/new/choose">open an issue</a>
                    to get them increased.
                </p>
            </div>
        </div>
    </div>
{%- endblock body -%}
